import pinia from "@/store"
import useUserStore from "@/store/modules/user"
let userStore = useUserStore(pinia)
export const isHasButton = (app: any) => {
    //全局自定义指令：实现按钮的权限
    app.directive('has', {
        //代表使用这个全局自定义指令的dom组件挂载完毕的时候会执行一次
        mounted(el:any, binding:any) {
            const { value } = binding
            // const buttons = JSON.parse(localStorage.getItem('buttons') as string)
            if (!userStore.buttons.includes(value)) {
                el.style.display = 'none'
            }
        }
    })
}